using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DBManager.DanhMucHeThong.BAL;
using DBManager.DanhMucHeThong.Entities;

namespace MamNonTuoiTho.Form.DanhMucHeThong
{
    public partial class frmGiaoVien_Edit : DevComponents.DotNetBar.Office2007Form
    {
        public int DanhMucID = -1;
        public frmGiaoVien_Edit()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;  
        }
        public void Huyen_Load()
        {
            if (DanhMucID != -1)
            {
                DanhMuc_Ent DanhMuc = DanhMuc_BAL.DanhMuc_GetItem(DanhMucID);
                txtTenGiaoVien.Text = DanhMuc.TenDanhMuc;
            }
        }
        private void cmdLuu_Click(object sender, EventArgs e)
        {
            try
            {
                if (DanhMucID == -1)
                {
                    DanhMuc_BAL.DanhMuc_Add(0, txtTenGiaoVien.Text.Trim(), "GiaoVien");
                }
                else
                {
                    DanhMuc_BAL.DanhMuc_Edit(DanhMucID, 0, txtTenGiaoVien.Text.Trim(), "GiaoVien");
                    DanhMucID = -1;
                    txtTenGiaoVien.Text = "";
                    this.Close();
                }
                txtTenGiaoVien.Text = "";
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void cmdQuayVe_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}